package com.cmc.cloud.cmclink.doc.api.document;

import com.cmc.cloud.cmclink.doc.api.document.rep.EqmFreeTimeRespDto;
import com.cmc.cloud.cmclink.doc.api.document.rep.EqmInfoSearchRespDto;
import com.cmc.cloud.cmclink.doc.api.document.rep.EqmVoyInfoRespDto;
import com.cmc.cloud.cmclink.doc.api.document.req.EqmBlInfoRespDto;
import com.cmc.cloud.cmclink.doc.api.document.req.EqmVoyInfoReqDto;
import com.cmc.cloud.cmclink.doc.api.document.req.so.EqmInfoSearchReqDto;
import com.cmc.cloud.cmclink.doc.constant.DocApiConstants;
import com.cmes.framework.common.pojo.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
 * @author lzp
 */
@FeignClient(name = DocApiConstants.NAME)
@Tag(name = "RPC - 服务 eqm基础信息查询")
@Valid
public interface EquipmentApi {

    String PREFIX = DocApiConstants.PREFIX + "/eqm";

    /**
     * 单证接口返回的出口预配信息清单 提单号有可能给的是订舱号和提单号
     *
     * @param eqmInfoSearchReqDto
     * @return
     */
    @PostMapping(PREFIX + "/ex/forecast")
    @Operation(summary = "单证接口返回的出口预配信息清单")
    CommonResult<List<EqmInfoSearchRespDto>> searchExForecastInfo(@Valid @RequestBody EqmInfoSearchReqDto eqmInfoSearchReqDto);

    /**
     * 单证接口返回的进口放箱信息清单
     *
     * @param eqmInfoSearchReqDto
     * @return
     */
    @PostMapping(PREFIX + "/im/forecast")
    @Operation(summary = "单证接口返回的进口放箱信息清单")
    CommonResult<List<EqmInfoSearchRespDto>> searchImForecastInfo(@Valid @RequestBody EqmInfoSearchReqDto eqmInfoSearchReqDto);

    /**
     * 查询提单号+港口的进出口航次接口
     *
     * @param voyInfoReqDto
     * @return
     */
    @PostMapping(PREFIX + "/voy")
    @Operation(summary = " 查询提单号+港口的进出口航次接口")
    CommonResult<EqmVoyInfoRespDto> searchVoyInfo(@Valid @RequestBody EqmVoyInfoReqDto voyInfoReqDto);

    /**
     * 查询提单信息
     *
     * @param blNo
     * @param pol
     * @return
     */
    @GetMapping(PREFIX + "/blinfo/{blNo}/{pol}")
    @Operation(summary = "查询提单信息")
    CommonResult<EqmBlInfoRespDto> searchBlInfo(@PathVariable("blNo") String blNo, @PathVariable("pol") String pol);

    /**
     * 箱管获取超期费率
     *
     * @param blnos
     * @return
     */
    @PostMapping(PREFIX + "/freetime")
    @Operation(summary = "箱管获取超期费率")
    CommonResult<List<EqmFreeTimeRespDto>> searchFreeTimeInfo(@RequestBody @NotEmpty List<String> blnos);
}
